use "kk_vax_mandate_data.dta", clear

* Analysis of treatment effects on Vaccine Confidence *
* Figure 1 *
svy:reg vci_additive approval lottery mandate  dem5 gop5 female i.AGE4 college  black latino 
coefplot, keep(approval lottery mandate) xline(0) ti("All respondents", size(medsmall)) xti("Change in Vaccine Confidence Index", size(small)) ///
saving(vci_all.gph, replace) xlabel(,labsize(small)) ylabel(,labsize(small)) graphregion(color(white))

svy:reg vci_additive approval lottery mandate  dem5 gop5 female i.AGE4 college  black latino if vaccinated == 0 
coefplot, keep(approval lottery mandate) xline(0) ti("Unvaccinated respondents", size(medsmall)) xti("Change in Vaccine Confidence Index", size(small)) ///
saving(vci_unvax.gph, replace) xlabel(,labsize(small)) ylabel(,labsize(small)) graphregion(color(white))

svy:reg vci_additive approval lottery mandate  dem5 gop5 female i.AGE4 college  black latino if blackorlatino==1
coefplot, keep(approval lottery mandate) xline(0) ti("Blacks and Latinx", size(medsmall)) xti("Change in Vaccine Confidence Index", size(small)) ///
saving(vci_poc.gph, replace) xlabel(,labsize(small)) ylabel(,labsize(small)) graphregion(color(white))

svy:reg vci_additive approval lottery mandate  dem5 gop5 female i.AGE4 college  black latino if gop5 == 1
coefplot, keep(approval lottery mandate) xline(0) ti("Republicans", size(medsmall)) xti("Change in Vaccine Confidence Index", size(small)) ///
saving(vci_gop.gph, replace) xlabel(,labsize(small)) ylabel(,labsize(small)) graphregion(color(white))

graph combine vci_all.gph vci_unvax.gph vci_poc.gph vci_gop.gph, graphregion(color(white))

* SI Table 1 *
svy:reg vci_additive approval lottery mandate  dem5 gop5 female i.AGE4 college  black latino 
outreg2 using sitable1, word dec(2) label  2aster  replace
svy:reg vci_additive approval lottery mandate  dem5 gop5 female i.AGE4 college  black latino if vaccinated == 0 
outreg2 using sitable1, word dec(2) label  2aster  append
svy:reg vci_additive approval lottery mandate  dem5 gop5 female i.AGE4 college  black latino if blackorlatino==1
outreg2 using sitable1, word dec(2) label  2aster  append
svy:reg vci_additive approval lottery mandate  dem5 gop5 female i.AGE4 college  black latino if gop5 == 1
outreg2 using sitable1, word dec(2) label  2aster  append


* SI Figure 1: Null effects using alternate measures of Vax Confidence *
svy:reg vax_safe approval lottery mandate  dem5 gop5 female i.AGE4 college  black latino 
coefplot, keep(approval lottery mandate) xline(0) ti("Vaccines are Safe", size(medsmall)) xti("Change in Belief", size(small)) ///
saving(safety_all.gph, replace) xlabel(,labsize(small)) ylabel(,labsize(small)) graphregion(color(white)) xlabel(-.6 -.4 -.2 0 .2 .4)

svy:reg vax_kids approval lottery mandate  dem5 gop5 female i.AGE4 college  black latino
coefplot, keep(approval lottery mandate) xline(0) ti("Vaccines Important for Children", size(medsmall)) xti("Change in Belief", size(small)) ///
saving(kids_all.gph, replace) xlabel(,labsize(small)) ylabel(,labsize(small)) graphregion(color(white)) xlabel(-.6 -.4 -.2 0 .2 .4)

svy:reg vax_effective approval lottery mandate  dem5 gop5 female i.AGE4 college  black latino
coefplot, keep(approval lottery mandate) xline(0) ti("Vaccines are Effective", size(medsmall)) xti("Change in Belief", size(small)) ///
saving(effective_all.gph, replace) xlabel(,labsize(small)) ylabel(,labsize(small)) graphregion(color(white)) xlabel(-.6 -.4 -.2 0 .2 .4)

svy:reg vci_factor_score approval lottery mandate  dem5 gop5 female i.AGE4 college  black latino 
coefplot, keep(approval lottery mandate) xline(0) ti("VCI Factor Score", size(medsmall)) xti("Change in Belief", size(small)) ///
saving(score_all.gph, replace) xlabel(,labsize(small)) ylabel(,labsize(small)) graphregion(color(white)) xlabel(-.6 -.4 -.2 0 .2 .4)

graph combine safety_all.gph kids_all.gph effective_all.gph score_all.gph, graphregion(color(white))

* Analysis of reported effects of mandate on social and economic activities *
* This requires reshaping the data *
use "kk_vax_mandate_data.dta", clear
reshape long act, i(CaseId) j(number)
tab act, gen(acts)
label var acts1 "Less likely" 
label var acts2 "No change"
label var acts3 "More likely"

label define actions 1 "School" 2 "Work" 3 "Church" 4 "Restaurants" 5 "Movies" 6 "Sports"
label values number actions

* All *
graph hbar acts1-acts3 [pw=WEIGHT], over(number) stack percent blabel(bar,pos(center) format(%9.1f) color(white)) ///
yti("") ylabel(0 "0%" 20 "20%" 40 "40%" 60 "60%" 80 "80%" 100 "100%") graphregion(color(white)) ///
bar(1, fcolor(gs0) lcolor(black)) bar(2, fcolor(gs5) lcolor(black)) bar(3, fcolor(gs10) lcolor(black)) ///
legend(order(1 "Less likely" 2 "No change" 3 "More likely") rows(1) size(small)) saving(act_all.gph, replace) ti("All respondents")

* Unvaccinated *
graph hbar acts1-acts3 if vaccinated == 0 [pw=WEIGHT], over(number) stack percent blabel(bar,pos(center) format(%9.1f) color(white)) ///
yti("") ylabel(0 "0%" 20 "20%" 40 "40%" 60 "60%" 80 "80%" 100 "100%") graphregion(color(white)) ///
bar(1, fcolor(gs0) lcolor(black)) bar(2, fcolor(gs5) lcolor(black)) bar(3, fcolor(gs10) lcolor(black)) ///
legend(order(1 "Less likely" 2 "No change" 3 "More likely") rows(1) size(small)) ti("Unvaccinated") saving(act_unvax.gph, replace) legend(size(small))

* Vaccinated *
graph hbar acts1-acts3 if vaccinated == 1 [pw=WEIGHT], over(number) stack percent blabel(bar,pos(center) format(%9.1f) color(white)) ///
yti("") ylabel(0 "0%" 20 "20%" 40 "40%" 60 "60%" 80 "80%" 100 "100%") graphregion(color(white)) ///
bar(1, fcolor(gs0) lcolor(black)) bar(2, fcolor(gs5) lcolor(black)) bar(3, fcolor(gs10) lcolor(black)) ///
legend(order(1 "Less likely" 2 "No change" 3 "More likely") rows(1) size(small)) ti("Vaccinated") saving(act_vax.gph, replace) legend(size(small))

* Democrats *
graph hbar acts1-acts3 if dem5 == 1 [pw=WEIGHT], over(number) stack percent blabel(bar,pos(center) format(%9.1f) color(white)) ///
yti("") ylabel(0 "0%" 20 "20%" 40 "40%" 60 "60%" 80 "80%" 100 "100%") graphregion(color(white)) ///
bar(1, fcolor(gs0) lcolor(black)) bar(2, fcolor(gs5) lcolor(black)) bar(3, fcolor(gs10) lcolor(black)) ///
legend(order(1 "Less likely" 2 "No change" 3 "More likely") rows(1) size(small)) ti("Democrats") saving(act_dem.gph, replace) legend(size(small))

* Republicans *
graph hbar acts1-acts3 if gop5 == 1 [pw=WEIGHT], over(number) stack percent blabel(bar,pos(center) format(%9.1f) color(white)) ///
yti("") ylabel(0 "0%" 20 "20%" 40 "40%" 60 "60%" 80 "80%" 100 "100%") graphregion(color(white)) ///
bar(1, fcolor(gs0) lcolor(black)) bar(2, fcolor(gs5) lcolor(black)) bar(3, fcolor(gs10) lcolor(black)) ///
legend(order(1 "Less likely" 2 "No change" 3 "More likely") rows(1) size(small)) ti("Republicans") saving(act_gop.gph, replace) legend(size(small))

* Blacks and Latinos *
graph hbar acts1-acts3 if blackorlatino == 1 [pw=WEIGHT], over(number) stack percent blabel(bar,pos(center) format(%9.1f) color(white)) ///
yti("") ylabel(0 "0%" 20 "20%" 40 "40%" 60 "60%" 80 "80%" 100 "100%") graphregion(color(white)) ///
bar(1, fcolor(gs0) lcolor(black)) bar(2, fcolor(gs5) lcolor(black)) bar(3, fcolor(gs10) lcolor(black)) ///
legend(order(1 "Less likely" 2 "No change" 3 "More likely") rows(1) size(small)) ti("Blacks and Latinx") saving(act_poc.gph, replace) legend(size(small))

* Figure 2 *
grc1leg2 act_all.gph act_unvax.gph act_gop.gph act_poc.gph, graphregion(color(white)) rows(2) cols(2)

* SI Figure 2 *
grc1leg2 act_vax.gph act_unvax.gph act_dem.gph act_gop.gph , graphregion(color(white)) rows(2)

* Figure 3 *
* Blacks and Latinos -- unvaccinated *
graph hbar acts1-acts3 if blackorlatino == 1 & vaccinated == 0 [pw=WEIGHT], over(number) stack percent blabel(bar,pos(center) format(%9.1f) color(white)) ///
yti("") ylabel(0 "0%" 20 "20%" 40 "40%" 60 "60%" 80 "80%" 100 "100%") graphregion(color(white)) ///
bar(1, fcolor(gs0) lcolor(black)) bar(2, fcolor(gs5) lcolor(black)) bar(3, fcolor(gs10) lcolor(black)) ///
legend(order(1 "Less likely" 2 "No change" 3 "More likely") rows(1) size(small)) ti("Blacks and Latinx") saving(act_poc_unvax.gph, replace) legend(size(small))

* Not Blacks and Latinos -- unvaccinated *
graph hbar acts1-acts3 if blackorlatino == 0 & vaccinated == 0 [pw=WEIGHT], over(number) stack percent blabel(bar,pos(center) format(%9.1f) color(white)) ///
yti("") ylabel(0 "0%" 20 "20%" 40 "40%" 60 "60%" 80 "80%" 100 "100%") graphregion(color(white)) ///
bar(1, fcolor(gs0) lcolor(black)) bar(2, fcolor(gs5) lcolor(black)) bar(3, fcolor(gs10) lcolor(black)) ///
legend(order(1 "Less likely" 2 "No change" 3 "More likely") rows(1) size(small)) ti("Not Black/Latinx") saving(act_nonpoc_unvax.gph, replace) legend(size(small))

* Republicans -- unvaccinated *
graph hbar acts1-acts3 if gop5 == 1 & vaccinated == 0 [pw=WEIGHT], over(number) stack percent blabel(bar,pos(center) format(%9.1f) color(white)) ///
yti("") ylabel(0 "0%" 20 "20%" 40 "40%" 60 "60%" 80 "80%" 100 "100%") graphregion(color(white)) ///
bar(1, fcolor(gs0) lcolor(black)) bar(2, fcolor(gs5) lcolor(black)) bar(3, fcolor(gs10) lcolor(black)) ///
legend(order(1 "Less likely" 2 "No change" 3 "More likely") rows(1) size(small)) ti("Republican") saving(act_gop_unvax.gph, replace) legend(size(small))

* Not Republicans -- unvaccinated *
graph hbar acts1-acts3 if gop5 == 0 & vaccinated == 0 [pw=WEIGHT], over(number) stack percent blabel(bar,pos(center) format(%9.1f) color(white)) ///
yti("") ylabel(0 "0%" 20 "20%" 40 "40%" 60 "60%" 80 "80%" 100 "100%") graphregion(color(white)) ///
bar(1, fcolor(gs0) lcolor(black)) bar(2, fcolor(gs5) lcolor(black)) bar(3, fcolor(gs10) lcolor(black)) ///
legend(order(1 "Less likely" 2 "No change" 3 "More likely") rows(1) size(small)) ti("Democrat or Independent") saving(act_nongop_unvax.gph, replace) legend(size(small))

grc1leg2 act_poc_unvax.gph act_nonpoc_unvax.gph act_gop_unvax.gph act_nongop_unvax.gph , graphregion(color(white)) rows(2)

